{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'macarons':'https://assets.pyecharts.org/assets/themes/macarons'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"b98aec89317649aba77821aed468aa87\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'macarons'], function(echarts) {\n",
       "        var chart_b98aec89317649aba77821aed468aa87 = echarts.init(\n",
       "            document.getElementById('b98aec89317649aba77821aed468aa87'), 'macarons', {renderer: 'canvas'});\n",
       "        var option_b98aec89317649aba77821aed468aa87 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"data\": [\n",
       "                5,\n",
       "                20,\n",
       "                36,\n",
       "                10,\n",
       "                75,\n",
       "                90\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"inside\",\n",
       "                    \"color\": \"#fff\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5927\\u503c\",\n",
       "                        \"type\": \"max\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5c0f\\u503c\",\n",
       "                        \"type\": \"min\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u5747\\u503c\",\n",
       "                        \"type\": \"average\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"silent\": false,\n",
       "                \"precision\": 2,\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"yAxis=50\",\n",
       "                        \"yAxis\": 50\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"data\": [\n",
       "                15,\n",
       "                6,\n",
       "                45,\n",
       "                20,\n",
       "                35,\n",
       "                66\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"inside\",\n",
       "                    \"color\": \"#fff\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5927\\u503c\",\n",
       "                        \"type\": \"max\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5c0f\\u503c\",\n",
       "                        \"type\": \"min\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u5747\\u503c\",\n",
       "                        \"type\": \"average\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"silent\": false,\n",
       "                \"precision\": 2,\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"yAxis=50\",\n",
       "                        \"yAxis\": 50\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u886c\\u886b\",\n",
       "                \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                \"\\u96ea\\u7eba\\u886b\",\n",
       "                \"\\u88e4\\u5b50\",\n",
       "                \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                \"\\u889c\\u5b50\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"axisLabel\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"formatter\": \"{value} \\u4e2a\"\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u4e3b\\u6807\\u9898\",\n",
       "            \"subtext\": \"\\u526f\\u6807\\u9898\"\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_b98aec89317649aba77821aed468aa87.setOption(option_b98aec89317649aba77821aed468aa87);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2124aa42080>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 官网： https://pyecharts.org/#/zh-cn/notebook\n",
    "# Bar柱状图\n",
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opt\n",
    "from pyecharts.globals import ThemeType\n",
    "\n",
    "\n",
    "#\n",
    "x = [\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"]\n",
    "y1 = [5, 20, 36, 10, 75, 90]\n",
    "y2 = [15, 6, 45, 20, 35, 66]\n",
    "\n",
    "# 默认\n",
    "# bar = Bar()\n",
    "# 设置主题\n",
    "# bar = Bar(init_opts=opt.InitOpts(theme=ThemeType.WESTEROS))\n",
    "bar = Bar(init_opts=opt.InitOpts(theme=ThemeType.MACARONS))\n",
    "# 延迟出现，动画效果\n",
    "# bar = Bar(init_opts=opt.InitOpts(animation_opts=opt.AnimationOpts(animation_delay=200, animation_easing='elasticOut')))\n",
    "bar.add_xaxis(x)\n",
    "bar.add_yaxis(\"商家A\", y1) # stack='stack1'：数据堆叠\n",
    "# bar.add_yaxis(\"商家B\", [15, 6, 45, 20, 35, 66], is_selected=False) # 默认不选择\n",
    "bar.add_yaxis(\"商家B\", y2)\n",
    "# label_opts=opt.LabelOpts(is_show=False) bar不显示值\n",
    "bar.set_global_opts(title_opts=opt.TitleOpts(title='主标题', subtitle='副标题'), toolbox_opts=opt.ToolboxOpts(),\n",
    "                   yaxis_opts=opt.AxisOpts(axislabel_opts=opt.LabelOpts(formatter='{value} 个')),\n",
    "                   # datazoom_opts=opt.DataZoomOpts(orient=\"vertical\"), # orient=\"vertical\"：y轴自定义变化，默认参数为x轴变化; type_='inside': 鼠标滚动实现\n",
    "                    # xaxis_opts=opt.AxisOpts(axislabel_opts=opt.LabelOpts(rotate=30)), # x轴文字倾斜rotate度\n",
    "                    # brush_opts=opt.BrushOpts(), # 增加图片操作按钮\n",
    "                   ) \n",
    "# 坐标横竖转换\n",
    "# bar.reversal_axis()  \n",
    "#bar.set_series_opts(label_opts=opt.LabelOpts(position='right'))\n",
    "\n",
    "# 自定义类型\n",
    "bar.set_series_opts(markpoint_opts=opt.MarkPointOpts(data=[opt.MarkPointItem(type_='max', name='最大值'),\n",
    "                                                          opt.MarkPointItem(type_='min', name='最小值'),\n",
    "                                                          opt.MarkPointItem(type_='average', name='均值'),                                                           \n",
    "                                                            ]\n",
    "                                                    ),\n",
    "                    markline_opts=opt.MarkLineOpts(data=[opt.MarkLineItem(y=50, name='yAxis=50')]  # 增加虚线\n",
    "                                                  ),\n",
    "                   )\n",
    "\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "pycharm": {}
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'echarts-gl':'https://assets.pyecharts.org/assets/echarts-gl.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"4db02fee082946b48159da650665a9bc\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'echarts-gl'], function(echarts) {\n",
       "        var chart_4db02fee082946b48159da650665a9bc = echarts.init(\n",
       "            document.getElementById('4db02fee082946b48159da650665a9bc'), 'white', {renderer: 'canvas'});\n",
       "        var option_4db02fee082946b48159da650665a9bc = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar3D\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    0,\n",
       "                    0,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    0,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    0,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    0,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    0,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    5,\n",
       "                    0,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    6,\n",
       "                    0,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    7,\n",
       "                    0,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    8,\n",
       "                    0,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    9,\n",
       "                    0,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    10,\n",
       "                    0,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    11,\n",
       "                    0,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    12,\n",
       "                    0,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    13,\n",
       "                    0,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    14,\n",
       "                    0,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    15,\n",
       "                    0,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    16,\n",
       "                    0,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    17,\n",
       "                    0,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    18,\n",
       "                    0,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    19,\n",
       "                    0,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    20,\n",
       "                    0,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    21,\n",
       "                    0,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    22,\n",
       "                    0,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    23,\n",
       "                    0,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    1,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    1,\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    1,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    1,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    1,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    5,\n",
       "                    1,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    6,\n",
       "                    1,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    7,\n",
       "                    1,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    8,\n",
       "                    1,\n",
       "                    11\n",
       "                ],\n",
       "                [\n",
       "                    9,\n",
       "                    1,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    10,\n",
       "                    1,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    11,\n",
       "                    1,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    12,\n",
       "                    1,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    13,\n",
       "                    1,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    14,\n",
       "                    1,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    15,\n",
       "                    1,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    16,\n",
       "                    1,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    17,\n",
       "                    1,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    18,\n",
       "                    1,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    19,\n",
       "                    1,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    20,\n",
       "                    1,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    21,\n",
       "                    1,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    22,\n",
       "                    1,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    23,\n",
       "                    1,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    2,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    2,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    2,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    2,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    2,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    5,\n",
       "                    2,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    6,\n",
       "                    2,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    7,\n",
       "                    2,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    8,\n",
       "                    2,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    9,\n",
       "                    2,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    10,\n",
       "                    2,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    11,\n",
       "                    2,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    12,\n",
       "                    2,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    13,\n",
       "                    2,\n",
       "                    11\n",
       "                ],\n",
       "                [\n",
       "                    14,\n",
       "                    2,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    15,\n",
       "                    2,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    16,\n",
       "                    2,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    17,\n",
       "                    2,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    18,\n",
       "                    2,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    19,\n",
       "                    2,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    20,\n",
       "                    2,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    21,\n",
       "                    2,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    22,\n",
       "                    2,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    23,\n",
       "                    2,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    3,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    3,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    3,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    3,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    3,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    5,\n",
       "                    3,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    6,\n",
       "                    3,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    7,\n",
       "                    3,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    8,\n",
       "                    3,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    9,\n",
       "                    3,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    10,\n",
       "                    3,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    11,\n",
       "                    3,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    12,\n",
       "                    3,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    13,\n",
       "                    3,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    14,\n",
       "                    3,\n",
       "                    11\n",
       "                ],\n",
       "                [\n",
       "                    15,\n",
       "                    3,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    16,\n",
       "                    3,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    17,\n",
       "                    3,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    18,\n",
       "                    3,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    19,\n",
       "                    3,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    20,\n",
       "                    3,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    21,\n",
       "                    3,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    22,\n",
       "                    3,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    23,\n",
       "                    3,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    4,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    4,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    4,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    4,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    4,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    5,\n",
       "                    4,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    6,\n",
       "                    4,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    7,\n",
       "                    4,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    8,\n",
       "                    4,\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    9,\n",
       "                    4,\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    10,\n",
       "                    4,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    11,\n",
       "                    4,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    12,\n",
       "                    4,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    13,\n",
       "                    4,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    14,\n",
       "                    4,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    15,\n",
       "                    4,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    16,\n",
       "                    4,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    17,\n",
       "                    4,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    18,\n",
       "                    4,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    19,\n",
       "                    4,\n",
       "                    11\n",
       "                ],\n",
       "                [\n",
       "                    20,\n",
       "                    4,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    21,\n",
       "                    4,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    22,\n",
       "                    4,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    23,\n",
       "                    4,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    5,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    5,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    5,\n",
       "                    11\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    5,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    5,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    5,\n",
       "                    5,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    6,\n",
       "                    5,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    7,\n",
       "                    5,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    8,\n",
       "                    5,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    9,\n",
       "                    5,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    10,\n",
       "                    5,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    11,\n",
       "                    5,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    12,\n",
       "                    5,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    13,\n",
       "                    5,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    14,\n",
       "                    5,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    15,\n",
       "                    5,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    16,\n",
       "                    5,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    17,\n",
       "                    5,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    18,\n",
       "                    5,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    19,\n",
       "                    5,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    20,\n",
       "                    5,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    21,\n",
       "                    5,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    22,\n",
       "                    5,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    23,\n",
       "                    5,\n",
       "                    4\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 20,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true\n",
       "    },\n",
       "    \"xAxis3D\": {\n",
       "        \"data\": [\n",
       "            \"12a\",\n",
       "            \"1a\",\n",
       "            \"2a\",\n",
       "            \"3a\",\n",
       "            \"4a\",\n",
       "            \"5a\",\n",
       "            \"6a\",\n",
       "            \"7a\",\n",
       "            \"8a\",\n",
       "            \"9a\",\n",
       "            \"10a\",\n",
       "            \"11a\",\n",
       "            \"12p\",\n",
       "            \"1p\",\n",
       "            \"2p\",\n",
       "            \"3p\",\n",
       "            \"4p\",\n",
       "            \"5p\",\n",
       "            \"6p\",\n",
       "            \"7p\",\n",
       "            \"8p\",\n",
       "            \"9p\",\n",
       "            \"10p\",\n",
       "            \"11p\"\n",
       "        ],\n",
       "        \"nameGap\": 20,\n",
       "        \"type\": \"category\",\n",
       "        \"axisLabel\": {\n",
       "            \"margin\": 8\n",
       "        }\n",
       "    },\n",
       "    \"yAxis3D\": {\n",
       "        \"data\": [\n",
       "            \"Saturday\",\n",
       "            \"Friday\",\n",
       "            \"Thursday\",\n",
       "            \"Wednesday\",\n",
       "            \"Tuesday\",\n",
       "            \"Monday\",\n",
       "            \"Sunday\"\n",
       "        ],\n",
       "        \"nameGap\": 20,\n",
       "        \"type\": \"category\",\n",
       "        \"axisLabel\": {\n",
       "            \"margin\": 8\n",
       "        }\n",
       "    },\n",
       "    \"zAxis3D\": {\n",
       "        \"nameGap\": 20,\n",
       "        \"type\": \"value\",\n",
       "        \"axisLabel\": {\n",
       "            \"margin\": 8\n",
       "        }\n",
       "    },\n",
       "    \"grid3D\": {\n",
       "        \"boxWidth\": 200,\n",
       "        \"boxHeight\": 100,\n",
       "        \"boxDepth\": 80,\n",
       "        \"viewControl\": {\n",
       "            \"autoRotate\": false,\n",
       "            \"autoRotateSpeed\": 10,\n",
       "            \"rotateSensitivity\": 1\n",
       "        }\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Bar3D\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_4db02fee082946b48159da650665a9bc.setOption(option_4db02fee082946b48159da650665a9bc);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2124ad034e0>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Bar 3D 柱状图\n",
    "from pyecharts.charts import Bar3D, Page\n",
    "import random\n",
    "\n",
    "\n",
    "data = [(i, j, random.randint(0, 12)) for i in range(6) for j in range(24)]\n",
    "bar3d = Bar3D()\n",
    "bar3d.add('', [[d[1], d[0], d[2]] for d in data], \n",
    "          xaxis3d_opts=opt.Axis3DOpts((\"12a 1a 2a 3a 4a 5a 6a 7a 8a 9a 10a 11a 12p 1p 2p 3p 4p 5p 6p 7p 8p 9p 10p 11p\".split()), type_='category'),\n",
    "          yaxis3d_opts=opt.Axis3DOpts(\"Saturday Friday Thursday Wednesday Tuesday Monday Sunday\".split(), type_='category'),\n",
    "          zaxis3d_opts=opt.Axis3DOpts(type_='value'),\n",
    "         )\n",
    "bar3d.set_global_opts(visualmap_opts=opt.VisualMapOpts(max_=20), title_opts=opt.TitleOpts(title='Bar3D'))\n",
    "\n",
    "bar3d.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "pycharm": {}
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'westeros':'https://assets.pyecharts.org/assets/themes/westeros'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"e8637aa8f10f4b2596be1b362c4c8bd8\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'westeros'], function(echarts) {\n",
       "        var chart_e8637aa8f10f4b2596be1b362c4c8bd8 = echarts.init(\n",
       "            document.getElementById('e8637aa8f10f4b2596be1b362c4c8bd8'), 'westeros', {renderer: 'canvas'});\n",
       "        var option_e8637aa8f10f4b2596be1b362c4c8bd8 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u886c\\u886b\",\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                    20\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u7eba\\u886b\",\n",
       "                    36\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u88e4\\u5b50\",\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                    75\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u889c\\u5b50\",\n",
       "                    90\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u886c\\u886b\",\n",
       "                    15\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u7eba\\u886b\",\n",
       "                    45\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u88e4\\u5b50\",\n",
       "                    20\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                    35\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u889c\\u5b50\",\n",
       "                    66\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u886c\\u886b\",\n",
       "                \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                \"\\u96ea\\u7eba\\u886b\",\n",
       "                \"\\u88e4\\u5b50\",\n",
       "                \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                \"\\u889c\\u5b50\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u4e3b\\u6807\\u9898\",\n",
       "            \"subtext\": \"\\u526f\\u6807\\u9898\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_e8637aa8f10f4b2596be1b362c4c8bd8.setOption(option_e8637aa8f10f4b2596be1b362c4c8bd8);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2124aa42da0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# line 折线图\n",
    "from pyecharts.charts import Line\n",
    "\n",
    "\n",
    "line = Line(init_opts=opt.InitOpts(theme=ThemeType.WESTEROS))\n",
    "line.add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "line.add_yaxis(\"商家A\", [5, 20, 36, 10, 75, 90])\n",
    "# is_connect_nones=True 空数据不会中断\n",
    "# is_smooth=True 平滑曲线链接\n",
    "# areastyle_opts=opt.AreaStyleOpts(opacity=0.5) 面积图，积分面积\n",
    "line.add_yaxis(\"商家B\", [15, 6, 45, 20, 35, 66], ) \n",
    "line.set_global_opts(title_opts=opt.TitleOpts(title='主标题', subtitle='副标题'))\n",
    "\n",
    "line.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "pycharm": {}
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'westeros':'https://assets.pyecharts.org/assets/themes/westeros'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"b3c2f7bf06b74fc785068f1e4c357237\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'westeros'], function(echarts) {\n",
       "        var chart_b3c2f7bf06b74fc785068f1e4c357237 = echarts.init(\n",
       "            document.getElementById('b3c2f7bf06b74fc785068f1e4c357237'), 'westeros', {renderer: 'canvas'});\n",
       "        var option_b3c2f7bf06b74fc785068f1e4c357237 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"2\\u7684\\u6307\\u6570\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u4e00\",\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e8c\",\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\",\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u56db\",\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e94\",\n",
       "                    16\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u516d\",\n",
       "                    32\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e03\",\n",
       "                    64\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u516b\",\n",
       "                    128\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e5d\",\n",
       "                    256\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 2,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"3\\u7684\\u6307\\u6570\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u4e00\",\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e8c\",\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\",\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u56db\",\n",
       "                    27\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e94\",\n",
       "                    81\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u516d\",\n",
       "                    247\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e03\",\n",
       "                    741\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u516b\",\n",
       "                    2223\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e5d\",\n",
       "                    6669\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 2,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"2\\u7684\\u6307\\u6570\",\n",
       "                \"3\\u7684\\u6307\\u6570\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"2\\u7684\\u6307\\u6570\": true,\n",
       "                \"3\\u7684\\u6307\\u6570\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"name\": \"x\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u4e00\",\n",
       "                \"\\u4e8c\",\n",
       "                \"\\u4e09\",\n",
       "                \"\\u56db\",\n",
       "                \"\\u4e94\",\n",
       "                \"\\u516d\",\n",
       "                \"\\u4e03\",\n",
       "                \"\\u516b\",\n",
       "                \"\\u4e5d\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"type\": \"log\",\n",
       "            \"name\": \"y\",\n",
       "            \"show\": true,\n",
       "            \"scale\": true,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Line\\u5bf9\\u6570\\u793a\\u4f8b\",\n",
       "            \"subtext\": \"\\u526f\\u6807\\u9898\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_b3c2f7bf06b74fc785068f1e4c357237.setOption(option_b3c2f7bf06b74fc785068f1e4c357237);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2124ad28b38>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# line折线图\n",
    "line = Line(init_opts=opt.InitOpts(theme=ThemeType.WESTEROS))\n",
    "line.add_xaxis([\"一\", \"二\", \"三\", \"四\", \"五\", \"六\", \"七\", \"八\", \"九\"])\n",
    "line.add_yaxis(\"2的指数\", [1, 2, 4, 8, 16, 32, 64, 128, 256], linestyle_opts=opt.LineStyleOpts(width=2))\n",
    "line.add_yaxis(\"3的指数\", [1, 3, 9, 27, 81, 247, 741, 2223, 6669], linestyle_opts=opt.LineStyleOpts(width=2)) \n",
    "line.set_global_opts(title_opts=opt.TitleOpts(title='Line对数示例', subtitle='副标题'),\n",
    "                    xaxis_opts=opt.AxisOpts(name='x'),\n",
    "                    yaxis_opts=opt.AxisOpts(type_='log', name='y', splitline_opts=opt.SplitLineOpts(is_show=True), is_scale=True))\n",
    "                    # yaxis_opts=opt.AxisOpts(type_='log', name='y', is_scale=True))\n",
    "\n",
    "line.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "pycharm": {}
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'westeros':'https://assets.pyecharts.org/assets/themes/westeros'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"94d07310dcf4441ca8df28d96e7a6c5d\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'westeros'], function(echarts) {\n",
       "        var chart_94d07310dcf4441ca8df28d96e7a6c5d = echarts.init(\n",
       "            document.getElementById('94d07310dcf4441ca8df28d96e7a6c5d'), 'westeros', {renderer: 'canvas'});\n",
       "        var option_94d07310dcf4441ca8df28d96e7a6c5d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u886c\\u886b\",\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                    20\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u7eba\\u886b\",\n",
       "                    36\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u88e4\\u5b50\",\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                    75\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u889c\\u5b50\",\n",
       "                    90\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u886c\\u886b\",\n",
       "                    15\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u7eba\\u886b\",\n",
       "                    45\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u88e4\\u5b50\",\n",
       "                    20\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                    35\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u889c\\u5b50\",\n",
       "                    66\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u886c\\u886b\",\n",
       "                \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                \"\\u96ea\\u7eba\\u886b\",\n",
       "                \"\\u88e4\\u5b50\",\n",
       "                \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                \"\\u889c\\u5b50\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u4e3b\\u6807\\u9898\",\n",
       "            \"subtext\": \"\\u526f\\u6807\\u9898\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_94d07310dcf4441ca8df28d96e7a6c5d.setOption(option_94d07310dcf4441ca8df28d96e7a6c5d);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2124ad49b38>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Line\n",
    "\n",
    "\n",
    "line = Line(init_opts=opt.InitOpts(theme=ThemeType.WESTEROS))\n",
    "line.add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "line.add_yaxis(\"商家A\", [5, 20, 36, 10, 75, 90])\n",
    "line.add_yaxis(\"商家B\", [15, 6, 45, 20, 35, 66])\n",
    "line.set_global_opts(title_opts=opt.TitleOpts(title='主标题', subtitle='副标题'))\n",
    "\n",
    "line.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {}
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
